<?php

function post_email_by_mailfunction($sub, $mes, $mail, $from = 'phpmailfunction') {
    $headers = "From: " . $from . " <" . $from . "@baidu.com>\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=utf-8\r\n";
    $headers .="Content-Transfer-Encoding: 8bit";

    $mes = htmlspecialchars_decode($mes, ENT_QUOTES); //optional - I use encoding to POST data
    return intval(mail($mail, "=?utf-8?B?" . base64_encode($sub) . "?=", $mes, $headers));
}

?>